Skip to content

Memoize useQuickActions internally, make useMemo unnecessary at callsites#3132

Merged
david-crespo merged 1 commit intomainfrom
memoize-quick-actions
Mar 18, 2026
Merged

Memoize useQuickActions internally, make useMemo unnecessary at callsites#3132
david-crespo merged 1 commit intomainfrom
memoize-quick-actions

Conversation

@david-crespo
Copy link
Collaborator

@david-crespo david-crespo commented Mar 18, 2026

Split out from #3131 because it's completely mechanical and all noise.

TIL additionalHooks, which lets you opt your own hooks into the dependency checking the linter does for useEffect and useMemo. This means we can turn useQuickActions into something that takes a function and a dep array and skip the useMemo. This is better because there was nothing preventing you from just forgetting the useMemo. Now it's built in. And it works: if you take one of the deps out of one of the arrays, you get the lint error.

The diff is very small if you hide whitespace changes.

@vercel
Copy link

vercel bot commented Mar 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
console Ready Ready Preview Mar 18, 2026 9:25pm

Request Review

Copy link
Contributor

@charliepark charliepark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Clever-but-in-a-good-way.

Base automatically changed from quick-actions-refactor to main March 18, 2026 21:24
@david-crespo david-crespo force-pushed the memoize-quick-actions branch from 6298987 to 7ead802 Compare March 18, 2026 21:24
@david-crespo david-crespo enabled auto-merge (squash) March 18, 2026 21:24
@david-crespo david-crespo merged commit c7362f2 into main Mar 18, 2026
7 checks passed
@david-crespo david-crespo deleted the memoize-quick-actions branch March 18, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants